package zpf;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.context.annotation.Bean;
import zpf.config.FeignConfig;

/**
 * @ClassName: ConsumerMovieFeignCustomWithoutHystrixFactoryApplication
 * @Description: TODO
 * @Autor: ZPF
 * @Date: 2021/1/15 9:42
 **/
@SpringBootApplication
@EnableHystrixDashboard
@EnableEurekaClient
@EnableFeignClients(defaultConfiguration = FeignConfig.class)
public class ConsumerMovieFeignCustomWithHystrixFactoryApplication {
    public static void main(String[] args) {
        SpringApplication.run(ConsumerMovieFeignCustomWithHystrixFactoryApplication.class, args);
        System.out.println("【电影Feign-HystrixFactory微服务】已启动.");
    }

//    //需加入该关键代码
//    @Bean
//    public ServletRegistrationBean hystrixMetricsStreamServlet(){
//        ServletRegistrationBean registrationBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
//        registrationBean.addUrlMappings("/actuator/hystrix.stream");
//        return registrationBean;
//    }
}
